import request from '@/utils/http';

/** 登录 */
export const login = (data: object) => {
  return request.post('login', data);
};

/** 登录 */
export const getUserInfo = () => {
  return request.get('getUserInfo');
};

/** 获取tree菜单列表 */
export const getMenuList = (): Promise<App.RequestResult> => {
  return request.get('menu/list');
};

/** 获取当前用户菜单列表 */
export const getCurrentUserPermissionsApi = (): Promise<App.RequestResult> => {
  return request.get('menu/getCurrentUserPermissions');
};

/** 新增菜单 */
export const addMenuApi = (data: any): Promise<App.RequestResult> => {
  return request.post('menu/add', data);
};

/** 删除菜单 */
export const deleteMenuApi = (params: any): Promise<App.RequestResult> => {
  return request.delete('menu/deleted', { params });
};

/** 修改密码 */
export const setPass = (data: any): Promise<App.RequestResult> => {
  return request.post(`changePassword`, data);
};

/** 修改用户信息 */
export const setUserInfoApi = (data: any): Promise<App.RequestResult> => {
  return request.post(`changeUserInfo`, data);
};


/** 添加店铺白名单 */
export const addShopWhiteListApi = (data: any): Promise<App.RequestResult> => {
    return request.post(`menu/addShopWhite`, data);
}

/** 白名单列表 */
export const getShopWhiteListApi = (params: any): Promise<App.RequestResult> => {
    return request.get(`menu/shopWhiteList`, { params });
}

/** 删除白名单 */
export const deleteShopWhiteListApi = (id: any): Promise<App.RequestResult> => {
    return request.delete(`menu/rmShopWhite/${id}`);
}